package ar.com.spsolutions.splibrary.validation.rules;

import java.util.ArrayList;
import java.util.List;

public class ValidationRuleSet extends ValidationRule {

    private final transient List<ValidationRule> rules = new ArrayList<ValidationRule>();

    @Override
    public void apply(final Object... objects) {
        for (ValidationRule rule : this.getRules()) {
            rule.apply(objects);
        }
    }

    public ValidationRuleSet addRule(final ValidationRule rule) {
        this.getRules().add(rule);
        return this;
    }

    private List<ValidationRule> getRules() {
        return this.rules;
    }

}
